package com.skivingcloud.report.datas.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.JsonNode;

import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Map;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

/**
 * <p>
 * 数据源管理
 * </p>
 *
 * @author skivingcloud
 * @since 2022-07-20
 */
@TableName(value = "sys_report_data_source" , autoResultMap = true)
@ApiModel(value = "ReportDataSource对象", description = "数据源管理")
public class ReportDataSource implements Serializable {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty("组件id")
    private String id;

    @ApiModelProperty("数据源编码")
    private String sourceCode;

    @ApiModelProperty("数据源名称")
    private String sourceName;

    @ApiModelProperty("数据源描述")
    private String sourceDesc;

    @ApiModelProperty("数据源类型SOURCE_TYPE")
    private String sourceType;

    @ApiModelProperty("数据源连接配置json：关系库{ jdbcUrl:'''', username:'''', password:'''' } ES{ hostList:''ip1:9300,ip2:9300,ip3:9300'', clusterName:''elasticsearch_cluster'' }  接口{ apiUrl:''http://ip:port/url'', method:'''' } javaBean{ beanNamw:''xxx'' }")
    @JsonProperty
    @TableField(value = "source_config", typeHandler = JacksonTypeHandler.class)
    private JsonNode sourceConfig;

    @ApiModelProperty("0--已禁用 1--已启用  DIC_NAME=ENABLE_FLAG")
    private String enableFlag;

    @ApiModelProperty(" 0--未删除 1--已删除 DIC_NAME=DEL_FLAG")
    private String deleteFlag;

    @ApiModelProperty("创建人")
    private String creater;

    @ApiModelProperty("创建时间")
    private LocalDateTime createTime;

    @ApiModelProperty("更新人")
    private String modUser;

    @ApiModelProperty("更新时间")
    private LocalDateTime modTime;

    @ApiModelProperty("版本号")
    private Integer version;

    /**关系型数据库jdbcUrl */
    @TableField(exist = false)
    private String jdbcUrl;

    /** 关系型数据库用户名 */
    @TableField(exist = false)
    private String username;

    /** 关系型数据库密码 */
    @TableField(exist = false)
    private String password;

    /** 关系型数据库驱动类 */
    @TableField(exist = false)
    private String driverName;

    /** 关系型数据库sql */
    @TableField(exist = false)
    private String sql;

    /** http requestUrl */
    @TableField(exist = false)
    private String apiUrl;

    /** http method */
    @TableField(exist = false)
    private String method;

    /** http header */
    @TableField(exist = false)
    private String header;

    /** http 请求体 */
    @TableField(exist = false)
    private String body;

    /** 动态查询sql或者接口中的请求体 */
    @TableField(exist = false)
    private String dynSentence;

    /** 传入的自定义参数，解决url中存在的动态参数*/
    @TableField(exist = false)
    private Map<String, Object> contextData;
    
    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }
    public String getSourceCode() {
        return sourceCode;
    }

    public void setSourceCode(String sourceCode) {
        this.sourceCode = sourceCode;
    }
    public String getSourceName() {
        return sourceName;
    }

    public void setSourceName(String sourceName) {
        this.sourceName = sourceName;
    }
    public String getSourceDesc() {
        return sourceDesc;
    }

    public void setSourceDesc(String sourceDesc) {
        this.sourceDesc = sourceDesc;
    }
    public String getSourceType() {
        return sourceType;
    }

    public void setSourceType(String sourceType) {
        this.sourceType = sourceType;
    }
    public JsonNode getSourceConfig() {
        return sourceConfig;
    }

    public void setSourceConfig(JsonNode sourceConfig) {
        this.sourceConfig = sourceConfig;
    }
    public String getEnableFlag() {
        return enableFlag;
    }

    public void setEnableFlag(String enableFlag) {
        this.enableFlag = enableFlag;
    }
    public String getDeleteFlag() {
        return deleteFlag;
    }

    public void setDeleteFlag(String deleteFlag) {
        this.deleteFlag = deleteFlag;
    }
    public String getCreater() {
        return creater;
    }

    public void setCreater(String creater) {
        this.creater = creater;
    }
    public LocalDateTime getCreateTime() {
        return createTime;
    }

    public void setCreateTime(LocalDateTime createTime) {
        this.createTime = createTime;
    }
    public String getModUser() {
        return modUser;
    }

    public void setModUser(String modUser) {
        this.modUser = modUser;
    }
    public LocalDateTime getModTime() {
        return modTime;
    }

    public void setModTime(LocalDateTime modTime) {
        this.modTime = modTime;
    }
    public Integer getVersion() {
        return version;
    }

    public void setVersion(Integer version) {
        this.version = version;
    }

    @Override
    public String toString() {
        return "ReportDataSource{" +
            "id=" + id +
            ", sourceCode=" + sourceCode +
            ", sourceName=" + sourceName +
            ", sourceDesc=" + sourceDesc +
            ", sourceType=" + sourceType +
            ", sourceConfig=" + sourceConfig +
            ", enableFlag=" + enableFlag +
            ", deleteFlag=" + deleteFlag +
            ", creater=" + creater +
            ", createTime=" + createTime +
            ", modUser=" + modUser +
            ", modTime=" + modTime +
            ", version=" + version +
        "}";
    }

    /**
     * @return the jdbcUrl
     */
    public String getJdbcUrl() {
        return jdbcUrl;
    }

    /**
     * @param jdbcUrl the jdbcUrl to set
     */
    public void setJdbcUrl(String jdbcUrl) {
        this.jdbcUrl = jdbcUrl;
    }

    /**
     * @return the username
     */
    public String getUsername() {
        return username;
    }

    /**
     * @param username the username to set
     */
    public void setUsername(String username) {
        this.username = username;
    }

    /**
     * @return the password
     */
    public String getPassword() {
        return password;
    }

    /**
     * @param password the password to set
     */
    public void setPassword(String password) {
        this.password = password;
    }

    /**
     * @return the driverName
     */
    public String getDriverName() {
        return driverName;
    }

    /**
     * @param driverName the driverName to set
     */
    public void setDriverName(String driverName) {
        this.driverName = driverName;
    }

    /**
     * @return the sql
     */
    public String getSql() {
        return sql;
    }

    /**
     * @param sql the sql to set
     */
    public void setSql(String sql) {
        this.sql = sql;
    }

    /**
     * @return the apiUrl
     */
    public String getApiUrl() {
        return apiUrl;
    }

    /**
     * @param apiUrl the apiUrl to set
     */
    public void setApiUrl(String apiUrl) {
        this.apiUrl = apiUrl;
    }

    /**
     * @return the method
     */
    public String getMethod() {
        return method;
    }

    /**
     * @param method the method to set
     */
    public void setMethod(String method) {
        this.method = method;
    }

    /**
     * @return the header
     */
    public String getHeader() {
        return header;
    }

    /**
     * @param header the header to set
     */
    public void setHeader(String header) {
        this.header = header;
    }

    /**
     * @return the body
     */
    public String getBody() {
        return body;
    }

    /**
     * @param body the body to set
     */
    public void setBody(String body) {
        this.body = body;
    }

    /**
     * @return String return the dynSentence
     */
    public String getDynSentence() {
        return dynSentence;
    }

    /**
     * @param dynSentence the dynSentence to set
     */
    public void setDynSentence(String dynSentence) {
        this.dynSentence = dynSentence;
    }

    /**
     * @return Map<String, Object> return the contextData
     */
    public Map<String, Object> getContextData() {
        return contextData;
    }

    /**
     * @param contextData the contextData to set
     */
    public void setContextData(Map<String, Object> contextData) {
        this.contextData = contextData;
    }

}
